package com.qn.visitor.intercept;

import com.qn.visitor.intercept.handler.*;
import com.qn.visitor.intercept.intercept.HashRuleIntercept;
import com.qn.visitor.intercept.intercept.IpAddressIntercept;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * qingniu-cloud user source analysis
 *
 * @Author: TXG
 * @Date: 2024/6/11
 * @Version V0.0.2
 */
@Configuration
public class InterceptHandlerBean {
    /**
     * 处理器调用链初始化
     * @return 调用链
     */
    @Bean
    public BaseInterceptHandler getHandlerBean() {
        //拦截器
        IRuleIntercept hashIntercept = new HashRuleIntercept();
        IRuleIntercept ipIntercept = new IpAddressIntercept();
        //处理器调用链
        BaseInterceptHandler handler = new IP4InterceptHandler(ipIntercept);
        handler = new CkfInterceptHandler(hashIntercept, handler);
        handler = new Ja4InterceptHandler(hashIntercept, handler);
        return handler;
    }
}
